package com.game.caro.server;

public class ReceiveCommand
{
	public static final int LOGIN=0;
	public static final int QUIT=1;
	public static final int DISCONNECT=2;	
	//ko phai chu
	//khi login vao thi moi joinroom ma?uh?
	//lam sao ma server nhan duoc nhieu thong bao nhi?message la sao?
	//
	private final int num;
	public ReceiveCommand(int _num)
	{
		this.num=_num;	
	}
	public int toInt()
	{
		return num;
	}
	public static ReceiveCommand valueOf(String message)
	{
		message=message.toUpperCase();
		if("LOGIN".equals(message))
		{
			return new ReceiveCommand(LOGIN);
		}
		if("QUIT".equals(message))
		{
			return new ReceiveCommand(QUIT);
		}
		if("DISCONNECT".equals(message))
		{
			return new ReceiveCommand(DISCONNECT);
		}
		throw new IllegalArgumentException("Unrecognized command:"+message);
	}
	
}
